home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / tpapi.exe / EXAMPLES / DOWN.PAS < prev    next >
Pascal/Delphi Source File  |  1994-01-14  |  3KB  |  88 lines

  1. {***************************************************************************}
  2. {** Program : DOWN.PAS                                                    **}
  3. {***************************************************************************}
  4. {** Version : 1.0             ** Started :           ** Ended :           **}
  5. {***************************************************************************}
  6. {******************************** Description ******************************}
  7. {***************************************************************************}
  8. {** DOWN allows a superviosr or equivalent to down the current server     **}
  9. {** from DOS.                                                             **}
  10. {**                                                                       **}
  11. {**                                                                       **}
  12. {**                                                                       **}
  13. {***************************************************************************}
  14. {******************************** Information ******************************}
  15. {***************************************************************************}
  16. {** USAGE : DOWN forcedown                                                **}
  17. {**                                                                       **}
  18. {** if forcedown is false then the server will NOT be downed if active    **}
  19. {** files are open.  if true then server will be forced down.             **}
  20. {**                                                                       **}
  21. {***************************************************************************}
  22.  
  23. program DOWN;
  24.  
  25. USES
  26.  
  27.   nwvar,
  28.   nwfsserv,
  29.   nwmisc;
  30.  
  31. CONST
  32.  
  33.   ProgramName = 'DOWN.EXE';
  34.   Version     = '1.0';
  35.   Description = 'Allows SUPERVISOR or equivalent to down a file server from DOS';
  36.  
  37. VAR
  38.  
  39.   FileServer  : FileServerOBJ;
  40.   MiscFunc    : MiscFuncOBJ;
  41.   ForceDown   : BYTE;
  42.   Error       : WORD;
  43.  
  44. {******}
  45.  
  46. procedure GetCommandLine;
  47.  
  48. BEGIN
  49.  
  50.   IF (PARAMCOUNT < 1) OR (NOT MiscFunc.SupervisorEquivalent) THEN
  51.     BEGIN
  52.  
  53.       WRITELN;
  54.       WRITELN ('Program : ', ProgramName);
  55.       WRITELN ('Version : ', Version);
  56.       WRITELN ('Description : ', Description);
  57.       WRITELN;
  58.       WRITELN ('USAGE : ');
  59.       WRITELN;
  60.       WRITELN ('DOWN forcedown');
  61.       WRITELN;
  62.       WRITELN ('if forcedown is true then server will go down regardless of open files');
  63.       HALT (1);
  64.  
  65.     END;
  66.  
  67.   IF MiscFunc.UppercaseNW (PARAMSTR (1) ) = 'TRUE' THEN
  68.     ForceDown := 255
  69.   ELSE
  70.     ForceDown := 0;
  71.  
  72. END; {procedure GetCommandLine}
  73.  
  74. {******}
  75.  
  76. BEGIN
  77.  
  78.   FileServer.Init (true);
  79.   MiscFunc.Init (true);
  80.   GetCommandLine;
  81.   Error := FileServer.DownFileServer (ForceDown);
  82.   IF Error <> 0 THEN
  83.     WRITELN ('Could not down server ERROR CODE : ', Error);
  84.   FileServer.Done;
  85.   MiscFunc.Done;
  86.  
  87. END.
  88.